package com.sakiko.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * ORM -object relationship mapper
 * <p>
 * 映射配置，框架可以按照面向对象的思想，对数据进行 CRUD操作
 * 基本操作 SQL框架可以自动生成，提高开发效率！！！
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "user") // 映射到 user表
public class User {
    @TableId(value = "id", type = IdType.AUTO) // 与主键字段映射，主键生成方式 auto_increment
    private Long id;
    @TableField(value = "name") // 一致可省略不写
    private String name;
    // @TableField(value = "age")
    private Integer age;
    // @TableField(value = "email")
    private String email;
    @TableLogic
    //逻辑删除字段 int mybatis-plus下,默认 逻辑删除值为 1 未逻辑删除 0
    private Integer deleted;

    public User(String name, Integer age, String email) {
        this.name = name;
        this.age = age;
        this.email = email;
    }

    public User(Long id, String name, Integer age, String email) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.email = email;
    }
}